<?php

namespace app\mall\controller\api\store;

use app\mall\enum\StatusEnum;
use app\mall\exceptions\ApiException;
use app\mall\model\MallGoods;
use app\mall\model\MallStore;

/**
 * 附近门店
 * Class Search
 * @package app\mall\controller\api\store
 */
class Search extends Base
{

    /**
     * @return \think\response\Json
     * @throws \app\mall\exceptions\BaseException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        $model = MallStore::where('status', StatusEnum::VALID);
        $model->order('inx', 'DESC');
        $model->order('id', 'desc');
        $model->field([
            'id', 'logo', 'address', 'business_hours', 'region_names', 'phone'
        ]);
        $list = $model->paginate();
        return json_return($list->items());
    }

}